home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SPACE 1
/
SPACE - Library 1 - Volume 1.iso
/
program
/
113
/
gfatip13
/
gfatip13.doc
< prev
next >
Wrap
Text File
|
1987-11-27
|
8KB
|
182 lines
November 27, 1987
GFATIP13.DOC
by John B. Holder
Senior Software Engineer
Marathon Computer Press
Asst. Sysop on GEnie's MichTron Roundtable
This is the (lucky) 13th issue in a planned series of
GFA Tip files. The topic of this issue is creating a Limited
Multi-tasking application in GFA Basic. In this archive you
will find the following files:
GFATIP13.BAS
GFATIP13.PRG
GFATIP13.DOC
Background
This GFATIP is designed to show you how to coax an
application into servicing several active processes within a
running program. It is NOT a Multi-Tasking Multi-User operating
system. In fact the program is very simple in construction and
facility. The whole purpose is to get you experimenting on your
own project once freshly seeded with the ideas presented here.
I could spend hours and hours (which I don't have) discussing
the principles of construction for a Multi-Tasking environment.
Instead I will allow the application to do most of the explaining,
and I'll brush on some of the concepts and then tell you what the
different parts of the program are going to hopefully demonstrate.
Concepts
Fact: Your computer spends more time at idle than at work.
Solution: Devise a way to share the CPU time among Multiple
processes.
Fiction: A GEM program is capable of Multi-Tasking.
Reason: When GEM displays an AES driven Dialog Box or Alert Box
for example, the entire processor will wait until the
exit box has been selected.
How To?: Limit the use of GEM dialogs and such to a minimum if
you are writing an application that intends to Multi-Task.
Not to get the author wrong here, I LOVE the GEM interface and
use it extensively. It's just not the best answer for a user
interface that needs to Multi-Task a running application.
Substance
This GFATIP consists of a simple Looping Round Robin Scheduler
constructed totally in GFA Basic. It's sole purpose in life is to:
1. Display up to 4 separate processes in action, (Activity Bars
within the process windows.
2. Allow the selective activation and deactivation of those
process displays.
3. Display a rudimentary Process Status for each Active/Inactive
window when called for.
4. Clear all Process Display windows on call.
5. Present an offline <HELP!> screen for the user if they need
to get a quick dump on what keys call what features.
6. Allow the user to press the ESCAPE key to get out of the
program and return to the Editor or GEM Desktop.
- - That's all there is! - -
I said simple now didn't I? Well, the program here is simple
and uses an integer Count% for setting up the process duration of
display instead of using a dedicated timer for each process. The
latter could be set up with the TIMER command in GFA Basic. This
would be more complex, however you could then assign process
priorities based on a (NICE) setting <Ala UNIX>. In plain english
you can allow separate amounts of CPU time for the child processes.
If you were doing a game program you could allow 25% of CPU time to
sound, 25% of time to reading the keyboard, and 50% of CPU time to
drawing the game objects and such. (Purely theoretical, the choice
is yours)
Uses
A. Games
B. Telecommunications
C. Text formatting Utilities
D. Equipment control
E. And anything else you put your mind and energy to
Programming Perspective
The truly mature and efficient application should be user
friendly & have an adaptive user interface, but should not sacrifice
the speed and capability of the Microprocessor. Since we now have an
inexpensive computer with excellent features coupled with a fast and
easy to use Language, why not put it to the test?! The wave of the
future is in Multi-Tasking, Multi-Programming, Multi-User systems.
Some would say "BUNK!". Who needs that on an ST? Well, to them I
must say "Read the writing on the Wall!". The popularity of products
like Micro RTX by Beckemeyer, FS II, OS 9, IDRIS, and BBS 2.1 &
Juggler by MichTron are starting to answer to these demands.
The Challenge
Why not put those neurons to work and develop a commercial
program written in GFA Basic that attempts to exploit the speed of
the language & all the while service multiple processes. Just
remember that you saw it here first... <Grin>
A Commercial?
I am presenting this GFATIP file in advance of the release of
The GFA Basic Companion II. There have been some facelifts to the
existing program & some really new innovative ideas added to the
Source Code Generator that create Totally new User interfacing ideas
that will allow the use of a Looping Scheduler. They can even be
interfaced with GEM routines if so chosen. Detached Pop-Up menus,
& Bottom up Menus can now enhance your programs. See the MichTron RT
libraries for demonstrations of The GFA Basic Companion II. I don't
normally advertise for my programs in a GFATIP, but this is a
significant step towards allowing for an efficient and attractive
user interface without sacrificing CPU time for user input. I
respect your comments on this subject.
GENIE > Address GRIFJOHN
CIS > Address 75766,505
Comments and PD release
This GFATIP file is in the public Domain. However, the
documentation file is Copyright (c)1987 by Marathon Computer Press,
and is provided as a public service. You may not include the text of
these files in any publication, or newsletter without the approval of
Marathon Computer Press. The source code and idea are free. You may
also post this file on any bulletin board as long as it is posted in
it's entirety. No charge (of any kind) may be assessed for providing
this Tip to the public. If it's not 100% Free, don't do it! Nuff
Said.
How to use GFATIP13.BAS / .PRG
Either run the program from the desktop or from within the GFA
Basic Editor. You'll see a screen with 4 non-GEM windows and a small
indicator box in each. To get the processes running press keys 1-4
on the keyboard. The processes can also be turned off by pressing
the keys again. If you want to see a process status for either an
active or inactive process, press the ALTERNATE key + keys 1-4 on the
main keyboard <not the numeric keypad>. You may do this as many
times as you desire while the processes are running. When you want
to clear the Process windows just press the Clr Home key. And if
this is just not enough, you may press Help to get a screen with
these features displayed. When you are ready to Quit the Program,
hit the ESC key. It is at this point that a GEM alert box will
appear asking you if you would like to stop or continue. Please note
that all activity ceases, just as mentioned above in the Concept
portion of this Doc file. Have fun with GFA Basic & This Tip File!
Sincerely,
John B. Holder